<?php
/**
 * Created by PhpStorm.
 * User: songs
 * Date: 2019/10/20
 * Time: 17:44
 */
use App\Models\Admin\OrderTempModel;
use App\admin\Service\OA;
use App\Models\Admin\OrderBaleModel;
use App\Models\User\UserModel;
use App\Jobs\Fun;
use App\Models\CompanysModel;
use App\Models\User\UserOrdersModel;
use App\Models\Admin\OrderCheckModel;

$out_trade_no = $_GET['out_trade_no'] ?? '';
if ($out_trade_no == '') {
    Fun::showmsg("参数错误");
}
$orderTempModel = OrderTempModel::where(['out_trade_no' => $out_trade_no])->first();
if (!$orderTempModel) {
    Fun::showmsg("订单不存在");
}
$out_trade_no = $orderTempModel->out_trade_no;
$uid = OA::$user->getId();
$type = null; ///gs表示公司  gc 表示工厂
if ($orderTempModel->cid == $uid) {
    $type = 'gs';    ///表示公司
} elseif ($orderTempModel->fid == $uid) {
    $type = 'gc';    ///表示工厂
} else {
    Fun::showmsg("您无权限操作表单");
}
$OrderCheckModel = OrderCheckModel::where(['out_trade_no' => $out_trade_no])->first();
$check_uid = '';
if ($OrderCheckModel && $OrderCheckModel->check_uid == OA::$user->getId()) {
    $check_uid = 'true';
}

?>
@extends("h5.layouts.main")
@section('content')
    <link rel="stylesheet" type="text/css" href="/h5/css/my.css">
    <link rel="stylesheet" type="text/css" href="../datepicker/jquery-ui.min.css">
    <link rel="stylesheet" type="text/css" href="../css/app.css">
    <link rel="stylesheet" type="text/css" href="../css/orderGrad.css">

    <input id="out_trade_no" value="<?= $orderTempModel->out_trade_no ?>" type="hidden"/>
    <input id="type" value="<?= $type ?>" type="hidden"/>
    <!-- 我的订单（抢单和订单） -->
    <div class="orderDockingPage">
        <div class="orderParamTitle">
        <span>跟单验货报告 (<?php
            if ($type == 'gs') {
                echo "公司";
            } else {
                echo "工厂";
            }
            ?>)</span>
            <a onclick="MC.back()" class="back"> <img src="../images/return.png" class="orderRtns"/></a>
        </div>
        <div style="height:1.066667rem"></div>
        <input type="hidden" value="<?= $check_uid ?>" id="check_uid"/>

        <div class="comCheckDiv">
            <?php if($OrderCheckModel){

                ?>
            <div id="settingPage">

                <div class="tablelist pagetop">
                    <ul>
                        <li class="clearfix li">
                            <span class="lable">加工企业</span>
                            <input type="text" value="<?= $OrderCheckModel['com_name']??'' ?>" name="com_name" placeholder="请输入"  class="value"/>
                        </li>
                        <li class="clearfix li">
                            <span class="lable">工厂负责人电话</span>
                            <input type="text" value="<?= $OrderCheckModel['com_tel']??'' ?>" placeholder="请输入" name="com_tel" class="value"/>
                        </li>
                    </ul>


                </div>
                <div style="height:15px"></div>
                <div class="settingParam">
                    <!--<p style="padding:0;">订单详情</p>-->
                    <!--stylelist 款式参数，一维数组：--><?php
                    $stylelist=[];
                    if($OrderCheckModel['stylelist']&&$OrderCheckModel['stylelist']!==''){
                        $stylelist=json_decode($OrderCheckModel['stylelist'],true);
                    }
                   // print_r($stylelist);exit;
                    ?>
                    <table cellspacing="0" id="stylelist">
                        <tr>
                            <td class="left">款号</td>
                            <td>
                                <input type="text" name="styleNo" value="<?= $stylelist['styleNo']??'' ?>" placeholder="请输入">
                            </td>
                        </tr>
                        <tr>
                            <td class="left">面料</td>
                            <td>
                                <input type="text" name="fabric" value="<?= $stylelist['fabric']??'' ?>" placeholder="请输入">
                            </td>
                        </tr>
                        <tr>
                            <td class="left">辅料</td>
                            <td>
                                <input type="text" name="assist" value="<?= $stylelist['assist']??'' ?>" placeholder="请输入">
                            </td>
                        </tr>
                        <tr>
                            <td class="left">订单数量</td>
                            <td>
                                <input type="number" name="orderNum" value="<?= $stylelist['orderNum']??'' ?>" placeholder="请输入">
                            </td>
                        </tr>
                        <tr>
                            <td class="left">裁剪数量</td>
                            <td>
                                <input type="number" name="cutNum" value="<?= $stylelist['cutNum']??'' ?>" placeholder="请输入">
                            </td>
                        </tr>
                        <tr>
                            <td class="left">生产本款人数</td>
                            <td>
                                <input type="number" name="staffNum" value="<?= $stylelist['staffNum']??'' ?>" placeholder="请输入">
                            </td>
                        </tr>
                        <tr>
                            <td class="left">裁制当天下货数量</td>
                            <td>
                                <input type="number" name="trimNum" value="<?= $stylelist['trimNum']??'' ?>" placeholder="请输入">
                            </td>
                        </tr>
                        <tr>
                            <td class="left">后道当天送货数量</td>
                            <td>
                                <input type="number" name="backNum" value="<?= $stylelist['backNum']??'' ?>" placeholder="请输入">
                            </td>
                        </tr>
                        <tr>
                            <td class="left">本款送货总数</td>
                            <td>
                                <input type="number" name="styleNum" value="<?= $stylelist['styleNum']??'' ?>" placeholder="请输入">
                            </td>
                        </tr>
                        <tr>
                            <td class="left">预计全部结束时间</td>
                            <td>
                                <input type="text" name="period" value="<?= $stylelist['period']??'' ?>" placeholder="请输入">
                            </td>
                        </tr>
                    </table>
                    <!--sizelist 尺码参数，一维数组：【M、L、XL、XXL】--><?php
                    $sizelist=[];
                    if($OrderCheckModel['sizelist']&&$OrderCheckModel['sizelist']!==''){
                        $sizelist=json_decode($OrderCheckModel['sizelist'],true);
                    }
                    // print_r($sizelist);exit;
                    ?>
                    <table cellspacing="0" id="sizelist">
                        <tr>
                            <td colspan="5" class="bg" style="text-align:center">
                                尺寸对照工艺单，标出大小公差就好
                            </td>
                        </tr>
                        <tr>
                            <td class="bg">部位</td>
                            <td class="td_M">M</td>
                            <td class="td_L">L</td>
                            <td class="td_XL">XL</td>
                            <td class="td_XXL">XXL</td>
                        </tr>
                        <tr>
                            <td class="bg left2">领围/腰围</td>
                            <td class="td_M">
                                <input type="text" placeholder="请输入" name="waist_1" value="<?= $sizelist['waist_1']??'' ?>">
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="waist_2" value="<?= $sizelist['waist_2']??'' ?>">
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="waist_3" value="<?= $sizelist['waist_3']??'' ?>">
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="waist_4" value="<?= $sizelist['waist_4']??'' ?>">
                            </td>
                        </tr>
                        <tr>
                            <td class="bg left2">袖长/臀围</td>
                            <td class="td_M">
                                <input type="text" placeholder="请输入" name="hip_1" value="<?= $sizelist['hip_1']??'' ?>">
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="hip_2" value="<?= $sizelist['hip_2']??'' ?>">
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="hip_3" value="<?= $sizelist['hip_3']??'' ?>">
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="hip_4" value="<?= $sizelist['hip_4']??'' ?>">
                            </td>
                        </tr>
                        <tr>
                            <td class="bg left2">后中长/裤长</td>
                            <td class="td_M">
                                <input type="text" placeholder="请输入" name="trouser_1" value="<?= $sizelist['trouser_1']??'' ?>">
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="trouser_2" value="<?= $sizelist['trouser_2']??'' ?>">
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="trouser_3" value="<?= $sizelist['trouser_3']??'' ?>">
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="trouser_4" value="<?= $sizelist['trouser_4']??'' ?>">
                            </td>
                        </tr>
                        <tr>
                            <td class="bg left2">胸围/拉链</td>
                            <td class="td_M">
                                <input type="text" placeholder="请输入" name="bust_1" value="<?= $sizelist['bust_1']??'' ?>">
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="bust_2" value="<?= $sizelist['bust_2']??'' ?>">
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="bust_3" value="<?= $sizelist['bust_3']??'' ?>">
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="bust_4" value="<?= $sizelist['bust_4']??'' ?>">
                            </td>
                        </tr>
                        <tr>
                            <td class="bg left2">下摆/脚口</td>
                            <td class="td_M">
                                <input type="text" placeholder="请输入" name="hem_1" value="<?= $sizelist['hem_1']??'' ?>">
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="hem_2" value="<?= $sizelist['hem_2']??'' ?>">
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="hem_3" value="<?= $sizelist['hem_3']??'' ?>">
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="hem_4" value="<?= $sizelist['hem_4']??'' ?>">
                            </td>
                        </tr>
                    </table>
                    <!--thrumlist 线头参数，二维数组：--><?php
                    $thrumlist=[];
                    if($OrderCheckModel['thrumlist']&&$OrderCheckModel['thrumlist']!==''){
                        $thrumlist=json_decode($OrderCheckModel['thrumlist'],true);
                    }
                    function radio($name,$val,$thrumlist){
                        $v=$thrumlist[$name]??'';
                        if($v==$val){
                            return 'checked';
                        }else{
                            return '';
                        }
                    }
                  //  print_r($thrumlist);exit;
                    ?>
                    <table cellspacing="0" id="thrumlist">
                        <tr>
                            <td colspan="2" class="bg">
                                重点检查
                            </td>
                            <td class="bg">缝制问题</td>
                        </tr>
                        <tr>
                            <td class="bg" rowspan="2">线头情况</td>
                            <td class="left3">
                                <label id="thrumInput1"><input type="radio" name="thrum" value="1" <?= radio('thrum','1',$thrumlist) ?>>有 </label>
                                &nbsp; &nbsp;
                                <label id="thrumInput2"><input type="radio" name="thrum" value="2" <?= radio('thrum','2',$thrumlist) ?>>少 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="thrum_text1" value="<?= $thrumlist['thrum_text1']??'' ?>">
                            </td>
                        </tr>
                        <tr>
                            <td class="left3">
                                <label id="thrumInput3"><input type="radio" name="thrum" value="3" <?= radio('thrum','3',$thrumlist) ?>>从剪 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入"name="thrum_text2" value="<?= $thrumlist['thrum_text2']??'' ?>">
                            </td>
                        </tr>


                        <tr>
                            <td class="bg" rowspan="2">污迹情况</td>
                            <td class="left3">
                                <label id="smearInput1"><input type="radio" name="smear" value="1" <?= radio('smear','1',$thrumlist) ?>>有 </label>
                                &nbsp; &nbsp;
                                <label id="smearInput2"><input type="radio" name="smear" value="2" <?= radio('smear','2',$thrumlist) ?>>少 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="smear_text1" value="<?= $thrumlist['smear_text1']??'' ?>">
                            </td>
                        </tr>
                        <tr>
                            <td class="left3">
                                <label id="smearInput3"><input type="radio" name="smear" value="3" <?= radio('smear','3',$thrumlist) ?>>无 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="smear_text2" value="<?= $thrumlist['smear_text2']??'' ?>">
                            </td>
                        </tr>


                        <tr>
                            <td class="bg" rowspan="2">毛脱漏情况</td>
                            <td class="left3">
                                <label id="hairInput1"><input type="radio" name="hair" value="1" <?= radio('hair','1',$thrumlist) ?>>有 </label>
                                &nbsp; &nbsp;
                                <label id="hairInput2"><input type="radio" name="hair" value="2" <?= radio('hair','2',$thrumlist) ?>>少 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="hair_text1" value="<?= $thrumlist['hair_text1']??'' ?>">
                            </td>
                        </tr>
                        <tr>
                            <td class="left3">
                                <label id="hairInput3"><input type="radio" name="hair" value="3" <?= radio('hair','3',$thrumlist) ?>>无 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="hair_text2" value="<?= $thrumlist['hair_text2']??'' ?>">
                            </td>
                        </tr>


                        <tr>
                            <td class="bg" rowspan="2">尺寸情况</td>
                            <td class="left3">
                                <label id="sizeInput1"><input type="radio" name="size" value="1" <?= radio('size','1',$thrumlist) ?>>超出误差范围 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="size_text1" value="<?= $thrumlist['size_text1']??'' ?>">
                            </td>
                        </tr>
                        <tr>
                            <td class="left3">
                                <label id="sizeInput2"><input type="radio" name="size" value="2" <?= radio('size','2',$thrumlist) ?>>在误差范围内 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="size_text2" value="<?= $thrumlist['size_text2']??'' ?>">
                            </td>
                        </tr>


                        <tr>
                            <td class="bg" rowspan="2">送货单是否清楚</td>
                            <td class="left3">
                                <label id="listInput1"><input type="radio" name="list" value="1" <?= radio('list','1',$thrumlist) ?>>清楚 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="list_text1" value="<?= $thrumlist['list_text1']??'' ?>">
                            </td>
                        </tr>
                        <tr>
                            <td class="left3">
                                <label id="listInput2"><input type="radio" name="list" value="2" <?= radio('list','2',$thrumlist) ?>>重填 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="list_text2" value="<?= $thrumlist['list_text2']??'' ?>">
                            </td>
                        </tr>


                        <tr>
                            <td class="bg" rowspan="2">明切线是否一致</td>
                            <td class="left3">
                                <label id="tangentInput1"><input type="radio" name="tangent" value="1" <?= radio('tangent','1',$thrumlist) ?>>是 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="tangent_text1" value="<?= $thrumlist['tangent_text1']??'' ?>">
                            </td>
                        </tr>
                        <tr>
                            <td class="left3">
                                <label id="tangentInput2"><input type="radio" name="tangent" value="2" <?= radio('tangent','2',$thrumlist) ?>>返修 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="tangent_text2" value="<?= $thrumlist['tangent_text2']??'' ?>">
                            </td>
                        </tr>


                        <tr>
                            <td class="bg" rowspan="2">包装是否整齐</td>
                            <td class="left3">
                                <label id="packInput1"><input type="radio" name="pack" value="1" <?= radio('pack','1',$thrumlist) ?>>是 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="pack_text" value="<?= $thrumlist['pack_text']??'' ?>">
                            </td>
                        </tr>
                        <tr>
                            <td class="left3">
                                <label id="packInput2"><input type="radio" name="pack" value="2" <?= radio('pack','2',$thrumlist) ?>>不是 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="pack_text2" value="<?= $thrumlist['pack_text2']??'' ?>">
                            </td>
                        </tr>


                        <tr>
                            <td class="bg" rowspan="2">整烫是否平服</td>
                            <td class="left3">
                                <label id="ironingInput1"><input type="radio" name="ironing" value="1" <?= radio('ironing','1',$thrumlist) ?>>是 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="ironing_text1" value="<?= $thrumlist['ironing_text1']??'' ?>">
                            </td>
                        </tr>
                        <tr>
                            <td class="left3">
                                <label id="ironingInput2"><input type="radio" name="ironing" value="2" <?= radio('ironing','2',$thrumlist) ?>>返修 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="ironing_text2" value="<?= $thrumlist['ironing_text2']??'' ?>">
                            </td>
                        </tr>


                        <tr>
                            <td class="bg" rowspan="2">加工单位是否配合</td>
                            <td class="left3">
                                <label id="devoteInput1"><input type="radio" name="devote" value="1" <?= radio('devote','1',$thrumlist) ?>>有 </label>
                                &nbsp; &nbsp;
                                <label id="devoteInput2"><input type="radio" name="devote" value="2" <?= radio('devote','2',$thrumlist) ?>>一般 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="devote_text1" value="<?= $thrumlist['devote_text1']??'' ?>">
                            </td>
                        </tr>
                        <tr>
                            <td class="left3">
                                <label id="devoteInput3"><input type="radio" name="devote" value="3" <?= radio('devote','3',$thrumlist) ?>>不是 </label>
                            </td>
                            <td>
                                <input type="text" placeholder="请输入" name="devote_text2" value="<?= $thrumlist['devote_text2']??'' ?>">
                            </td>
                        </tr>
                    </table>
                    <br>
                </div>

                <div class="orderDocumentaryInspectionReport ">
                    <div class="content5">
                        <p>内容</p>
                        <div>
                            <textarea name="detail" maxlength="200" placeholder="请输入您遇到的问题（10-200字）"><?= $OrderCheckModel['detail'] ?></textarea>
                        </div>
                    </div>
                    <div class="content6">
                        <ul>
                            <li><span>工厂总人数</span><input type="number" value="<?= $OrderCheckModel['staffTotalNum'] ?>" name="staffTotalNum" placeholder="请输入"></li>
                            <li><span>本款生产人数</span><input type="number" value="<?= $OrderCheckModel['staffStyleNum'] ?>" name="staffStyleNum" placeholder="请输入"></li>
                            <li><span>后道全部结束时间</span><input type="text" value="<?= Fun::date($OrderCheckModel['finishTime'],false) ?>" name="finishTime" placeholder="请输入"></li>
                        </ul>
                    </div>
                    <div class="content7">
                        备注：外协单位出货时，必须有跟单员验货报告，经验货合格后，双方签字方可送货。
                    </div>
                </div>


            </div>
            <?php if($check_uid !== ''){ ?>
            <div class="saveDiv">
                <a class="button savebutton">保存</a>
            </div>
            <?php }
            }else{ ?>

            <h2 class="gdnull">公司未设置跟单验货报告</h2>


            <?php } ?>


        </div>
    </div>



    <script src="../datepicker/jquery-ui.min.js"></script>

    <script>
        new MC.Order.comCheck();

    </script>
@stop